package com.itheima.demo.demo11;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Test_2 {
    public static void main(String[] args) throws IOException {
        Socket ck=new Socket("192.168.35.37",8888);
        OutputStream os = ck.getOutputStream();
        os.write("客户来了".getBytes());
        //然后解析会写的内容
        InputStream is = ck.getInputStream();
        int len=0;
        byte[]b=new byte[1024];
        while ((len=is.read(b))!=-1){
            System.out.println(new String(b,0,len));
        }
        is.close();
        os.close();
        ck.close();

    }
}
